package com.turtle3d.formallanguage.symbol;

import java.util.ArrayList;

/**
 * Symbol class. Defines methods, for example F(radius*1.1, height*1.1). 
 * Does not store parameters (radius, height).
 * parameters are stored by symbol instances.
 * Formal language productions are defined using LSymbolClasses.
 * 
 * @author Marek Paterczyk <marek.paterczyk@gmail.com>
 *
 */
public class SymbolClass
{
	/**
	 * Name used for comparsion of instances, for example F.
	 */
	private String symbol;
	/**
	 * Unique class name, for example F(radius*1.1)
	 */
	private String symbolClassName;
	/**
	 * List of methods.
	 */	
	private ArrayList<Method> methods = new ArrayList<Method>();
			
	public SymbolClass(String symbol, String symbolClassName)
	{
		super();
		this.symbol = symbol;
		this.symbolClassName = symbolClassName;
	}
	
	/**
	 * 
	 * @param symbolClassName is something like F(r*1.2)
	 */
	public SymbolClass(String symbolClassName){
		this.symbol=symbolClassName.substring(0,1);
		this.symbolClassName=symbolClassName;
	}

	public void addMethod(Method method){
		methods.add(method);
	}
	
	public ArrayList<Method> getMethods(){
		return methods;
	}
	
	@Override
	public boolean equals(Object obj)
	{
		return symbol.equals(obj.toString());
	}
	
	@Override
	public String toString(){
		return symbol;
	}

	public String getSymbol()
	{
		return symbol;
	}

	public String getSymbolClassName()
	{
		return symbolClassName;
	}

}
